﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPIS.GERP.GBMS.IBLL;
using KPIS.GERP.GBMS.MODEL;
using KPIS.GERP.GBMS.DAL;
using KPIS.GERP.GBMS.DALFactory;

namespace KPIS.GERP.GBMS.BLL
{
    public sealed class ProjectRequestExpenseBLL : IProjectExpenseBLL
    {
        private static readonly IProjectRequestExpenseDAL dal = DataAccess.CreateProjectExpense();

        public void Insert(string descr, string price, string qty, string unit, string remark, string mtef1, string mtef2, string mtef3, string source, string exp, string resource)
        {
            //if (pjDAL.Insert(pjInfo) > 0)
            //{

            //}
            //else
            //{

            //}
        }

        public void Update(string seq, string descr, string price, string qty, string unit, string remark, string mtef1, string mtef2, string mtef3, string source, string exp, string resource)
        {
            //if (pjDAL.Update(pjInfo) > 0)
            //{

            //}
            //else
            //{

            //}
        }

        public void Delete(string seq)
        {
            //if (pjDAL.Delete(pjInfo) > 0)
            //{

            //}
            //else
            //{

            //}
        }

        public IList<ProjectExpenseInfo> Search(string seq, string pj, string source, string exp)
        {
            SourceInfo srcInfo = new SourceInfo();
            ExpenseInfo expInfo = new ExpenseInfo();
            ProjectInfo pjInfo = new ProjectInfo();

            int inSeq = (seq.Length > 0) ? Convert.ToInt32(seq) : 0;
            int inSource = (source.Length > 0) ? Convert.ToInt32(source) : 0;
            int inExp = (exp.Length > 0) ? Convert.ToInt32(exp) : 0;
            int inPj = (pj.Length > 0) ? Convert.ToInt32(pj) : 0;

            srcInfo.Sequence = inSource;
            expInfo.Sequence = inExp;
            pjInfo.Sequence = inPj;

            return dal.Search(new ProjectExpenseInfo(inSeq, pjInfo, srcInfo, expInfo));
        }
    }
}
